#!/bin/csh 
#.................................................................................................

setenv NCARG_ROOT  /Users/zhan524/tools/ncl_ncarg-6.0.0.MacOS_10.6_64bit_nodap_gcc421 
setenv NCARG_ROOT  /share/apps/ncl/6.0.0/gnu

setenv makeplot "T" 
setenv plotform "pdf" 
setenv plotview "png" 


if ($makeplot == "T") then 

echo OK 

#.................................................................................................
###
###cat > load_setup.ncl << EOF
###
###  plotfmt = "$plotform"
###  shortname = "presc_nudge_cam5_X0021-X0024_2000-2002" 
###
###  ca = "X0024"
###  cb = "X0021"
###
###  na = "X0024" ;;presc BN PI" 
###  nb = "X0021" ;;presc BN PD" 
###
###  basepa = "/pic/scratch/zhan524/"
###  basepb = "/pic/scratch/zhan524/"
###
###  ma = ".cam2.h0.2000-2002.ANN.nc" 
###  mb = ".cam2.h0.2000-2002.ANN.nc" 
###
###EOF
###
###foreach exe (*.ncl)
###   echo ncl $exe
###   ncl $exe
###end
###
#.................................................................................................

cat > load_setup.ncl << EOF

  plotfmt = "$plotform"
  shortname = "presc_nudge_cam5_X0021-X0025_2000" 

  ca = "X0025"
  cb = "X0021"

  na = "X0025" ;;presc BN PI" 
  nb = "X0021" ;;presc BN PD" 

  basepa = "/pic/scratch/zhan524/"
  basepb = "/pic/scratch/zhan524/"

  ma = ".cam2.h0.2000.ANN.nc" 
  mb = ".cam2.h0.2000.ANN.nc" 

EOF


foreach exe (*.ncl)
   echo ncl $exe
   ncl $exe
end

####.................................................................................................
###
###cat > load_setup.ncl << EOF
###
###  plotfmt = "$plotform"
###  shortname = "presc_nudge_cam5_X0021-X0024_2001" 
###
###  ca = "X0024"
###  cb = "X0021"
###
###  na = "X0024" ;;presc BN PI" 
###  nb = "X0021" ;;presc BN PD" 
###
###  basepa = "/pic/scratch/zhan524/"
###  basepb = "/pic/scratch/zhan524/"
###
###  ma = ".cam2.h0.2001.ANN.nc" 
###  mb = ".cam2.h0.2001.ANN.nc" 
###
###EOF
###
###
###foreach exe (*.ncl)
###   echo ncl $exe
###   ncl $exe
###end
###
####.................................................................................................
###
###cat > load_setup.ncl << EOF
###
###  plotfmt = "$plotform"
###  shortname = "presc_nudge_cam5_X0021-X0024_2002" 
###
###  ca = "X0024"
###  cb = "X0021"
###
###  na = "X0024" ;;presc BN PI" 
###  nb = "X0021" ;;presc BN PD" 
###
###  basepa = "/pic/scratch/zhan524/"
###  basepb = "/pic/scratch/zhan524/"
###
###  ma = ".cam2.h0.2002.ANN.nc" 
###  mb = ".cam2.h0.2002.ANN.nc" 
###
###EOF
###
###
###foreach exe (*.ncl)
###   echo ncl $exe
###   ncl $exe
###end


endif

#.................................................................................................
# convert to other format 
#.................................................................................................
 
if($plotform == "eps") then
if($plotview == "png") then
   foreach ff (*.eps)
      echo $ff.png
      convert -density 200 $ff $ff.png
   end
endif
endif

mv -f *.png plot_png 
mv -f *.eps plot_eps 
mv -f *.pdf plot_pdf



